{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
	<h3 class="h3-title">审批类型</h3>
	{eq name="$id" value="0"}
	<table class="layui-table">
		<tr>
			<td class="layui-td-gray">所属分类<font>*</font></td>
			<td>
				<select name="type" lay-verify="required" lay-reqText="请选择所属分类">
				  <option value="">--请选择--</option>
				  <option value="1">假勤</option>
				  <option value="2">行政</option>
				  <option value="3">财务</option>
				  <option value="4">人事</option>
				  <option value="5">其他</option>
				  <option value="6">报销</option>
				  <option value="7">发票</option>
				</select>
			</td>
			<td class="layui-td-gray">名称<font>*</font></td>
			<td>
				<input type="text" name="title" autocomplete="off" placeholder="请输入审批类型名称" lay-verify="required" lay-reqText="请输入审批类型名称" class="layui-input">
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">标识<font>*</font></td>
			<td>
				<input type="text" name="name" placeholder="请输入审批类型标识" value="" autocomplete="off" lay-verify="required" lay-reqText="请输入审批类型标识" class="layui-input">
			</td>
			<td class="layui-td-gray">图标<font>*</font></td>
			<td>
				<input style="width:150px; display:inline" class="layui-input" type="text" name="icon" value="" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >			
				如：icon-jichuguanli<a href="/static/layui/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
			</td>
		</tr>
	</table>
	{else/}
	<table class="layui-table">
		<tr>
			<td class="layui-td-gray">所属分类<font>*</font></td>
			<td>
				<select name="type" lay-verify="required" lay-reqText="请选择所属分类">
				  <option value="">--请选择--</option>
				  <option value="1" {eq name="$detail.type" value="1"}selected=""{/eq}>假勤</option>
				  <option value="2" {eq name="$detail.type" value="2"}selected=""{/eq}>行政</option>
				  <option value="3" {eq name="$detail.type" value="3"}selected=""{/eq}>财务</option>
				  <option value="4" {eq name="$detail.type" value="4"}selected=""{/eq}>人事</option>
				  <option value="5" {eq name="$detail.type" value="5"}selected=""{/eq}>其他</option>
				  <option value="6" {eq name="$detail.type" value="6"}selected=""{/eq}>报销</option>
				  <option value="7" {eq name="$detail.type" value="7"}selected=""{/eq}>发票</option>
				</select>
			</td>
			<td class="layui-td-gray">名称<font>*</font></td>
			<td>
				<input type="text" name="title" value="{$detail.title}" placeholder="请输入审批类型名称" lay-verify="required" lay-reqText="请输入审批类型名称" class="layui-input">
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">标识<font>*</font></td>
			<td>
				<input type="text" name="name" placeholder="请输入审批类型标识" value="{$detail.name}" autocomplete="off" lay-verify="required" lay-reqText="请输入审批类型标识" class="layui-input">
			</td>
			<td class="layui-td-gray">图标<font>*</font></td>
			<td>
				<input style="width:150px; display:inline" class="layui-input" type="text" name="icon" value="{$detail.icon}" placeholder="请输入审批类型图标" lay-verify="required" lay-reqText="请输入审批类型图标" >			
				如：icon-jichuguanli<a href="/static/layui/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
			</td>
		</tr>
	</table>
	{/eq}
	<div style="padding: 10px 0">
		<input type="hidden" name="id" value="{$id}">
		<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	function init(layui){
		var form = layui.form
		,layer = layui.layer;
		  
		//监听提交
		form.on('submit(webform)', function(data){
			$.ajax({
				url: "/home/cate/flow_type_add",
				type:'post',
				data:data.field,
				success: function (e) {
					layer.msg(e.msg);
					if (e.code == 0) {	
						parent.tableIns.reload();
						setTimeout(function(){							
							parent.layui.rightpage.close();
						},1000);
					}
				}
			})
			return false;
		});
	}
</script>
{include file="../../base/view/common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->